package sctu.edu.java.year2016.team06.lvjiafu.day20160523.chapter6_1;

/**
 * Created by lvjiafu on 2016/5/23.
 * 在项目中创建Number类，判断"mingrikejijavabu"中字符‘i’出现了几次，并将结果输出
 */
public class Number {
    public static void main(String[] args){
        String s=new String("mingrikejijavabu");
        int n=0;
        for(int j=0;j<s.length();j++){
            if(s.charAt(j) == 'i')
                n++;
        }
        System.out.println("字符串“mingrikejijavabu”中‘i’出现了"+n+"次");
    }
}